{include file="common/mainHead"/}
<style>
	
	.pagination {
	display: inline-block;
	padding-left: 0;
	margin: 20px 0;
	border-radius: 4px;
	float: right;
}

.pagination>li {
	display: inline
}

.pagination>li>a,
.pagination>li>span {
	position: relative;
	float: left;
	padding: 6px 12px;
	margin-left: -1px;
	line-height: 1.42857143;
	color: #337ab7;
	text-decoration: none;
	background-color: #fff;
	border: 1px solid #ddd
}

.pagination>li:first-child>a,
.pagination>li:first-child>span {
	margin-left: 0;
	border-top-left-radius: 4px;
	border-bottom-left-radius: 4px
}

.pagination>li:last-child>a,
.pagination>li:last-child>span {
	border-top-right-radius: 4px;
	border-bottom-right-radius: 4px
}

.pagination>li>a:focus,
.pagination>li>a:hover,
.pagination>li>span:focus,
.pagination>li>span:hover {
	z-index: 2;
	color: #23527c;
	background-color: #eee;
	border-color: #ddd
}

.pagination>.active>a,
.pagination>.active>a:focus,
.pagination>.active>a:hover,
.pagination>.active>span,
.pagination>.active>span:focus,
.pagination>.active>span:hover {
	z-index: 3;
	color: #fff;
	cursor: default;
	background-color: #337ab7;
	border-color: #337ab7
}

.pagination>.disabled>a,
.pagination>.disabled>a:focus,
.pagination>.disabled>a:hover,
.pagination>.disabled>span,
.pagination>.disabled>span:focus,
.pagination>.disabled>span:hover {
	color: #777;
	cursor: not-allowed;
	background-color: #fff;
	border-color: #ddd
}

.pagination-lg>li>a,
.pagination-lg>li>span {
	padding: 10px 16px;
	font-size: 18px;
	line-height: 1.3333333
}

.pagination-lg>li:first-child>a,
.pagination-lg>li:first-child>span {
	border-top-left-radius: 6px;
	border-bottom-left-radius: 6px
}

.pagination-lg>li:last-child>a,
.pagination-lg>li:last-child>span {
	border-top-right-radius: 6px;
	border-bottom-right-radius: 6px
}

.pagination-sm>li>a,
.pagination-sm>li>span {
	padding: 5px 10px;
	font-size: 12px;
	line-height: 1.5
}

.pagination-sm>li:first-child>a,
.pagination-sm>li:first-child>span {
	border-top-left-radius: 3px;
	border-bottom-left-radius: 3px
}

.pagination-sm>li:last-child>a,
.pagination-sm>li:last-child>span {
	border-top-right-radius: 3px;
	border-bottom-right-radius: 3px
}
	
</style>

<div class="admin-main fadeInUp animated">
 <blockquote class="layui-elem-quote">
        <form class="layui-form" style="float:left;" action="{:url('index')}" method="post">
            
            
            <div class="layui-form-item" style="margin:0;">
            	
                <div class="layui-input-inline">
                    <input type="text" name="key" id="key" value="{$testkey}" placeholder="{:lang('pleaseEnter')}关键字！" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux" style="padding:0;">
                    <button type="submit" class="layui-btn"><i class="fa fa-search" aria-hidden="true"></i> 查询</button>
                    <a href="{:url('index')}" class="layui-btn">显示全部</a>
                </div>
            </div>
        </form>
        <a href="{:url('add')}" class="layui-btn" style="float:right;"><i class="fa fa-plus" aria-hidden="true"></i>添加商品</a>
        <div style="clear: both;"></div>
    </blockquote>
    <fieldset class="layui-elem-field">
        <legend>商品管理</legend>
        <div class="layui-field-box table-responsive">
       
                <table class="layui-table table-hover">
                    <thead>
                    <tr>
                        <th>编号</th>
                        <th>分类</th>
                        <th>标题</th>
                        <th>是否是奖品</th>
                        <th>是否推荐</th>
                        <th>添加时间</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <!--内容容器-->
                    <tbody id="con">
                    {volist name="$list" id="v"}
                    <tr>
                        <td>{$v.id}</td> 
                        <td>{$v.name}</td>
                        <td>{$v.title}</td>
                        <td>
                        	{if condition="$v.iszhiding eq 1"}
                        	<a class="red" href="javascript:" onclick="zhiding({$v.id},'0');" title="已开启">
                                <div id="yz270">
                                    <button class="layui-btn layui-btn-mini layui-btn-danger">
                                        是
                                    </button>
                                </div>
                            </a>
                            
                            {else /}
                           <a class="red" href="javascript:" onclick="zhiding({$v.id},'1')" title="已开启">
                                <div id="zt1">
                                    <button class="layui-btn layui-btn-warm layui-btn-mini">否</button>
                                </div>
                            </a> 
                            {/if}
                            
                        	
                        </td>
                        <td>
                        	{if condition="$v.iszd eq 1"}
                        	<a class="red" href="javascript:" onclick="zd({$v.id},'0');" title="已开启">
                                <div id="yz270">
                                    <button class="layui-btn layui-btn-mini layui-btn-danger">
                                        是
                                    </button>
                                </div>
                            </a>
                            
                            {else /}
                           <a class="red" href="javascript:" onclick="zd({$v.id},'1')" title="已开启">
                                <div id="zt1">
                                    <button class="layui-btn layui-btn-warm layui-btn-mini">否</button>
                                </div>
                            </a> 
                            {/if}
                            
                        	
                        </td>
                        
                        <td>{$v.addtime}</td>
                        <td>
                            <a href="{:url('edit',['id'=>$v['id']])}" class="layui-btn layui-btn-mini">编辑</a>
                            <a href="javascript:;" onclick="return del('{$v.id}')" class="layui-btn layui-btn-mini layui-btn-danger">删除</a>
                            <a href="{:url('addshuxing',['id'=>$v['id']])}" class="layui-btn layui-btn-mini">添加规格</a>
                       
                        </td>
                    </tr>
                    {/volist}
                    </tbody>
                </table>
        
               {$page}
        </div>
     
        
    </fieldset>
</div>
{include file="common/mainFoot"/}
<script>
    layui.use('layer',function() {
        var layer = layui.layer;
    });
    function del(id) {
        layer.confirm('你确定要删除吗？', {icon: 3}, function (index) {
            layer.close(index);
            window.location.href = "{:url('del')}?id=" + id;
        });
    }

    
    
    
    function zhiding(id,value){
    	var isz;
    
    	if(value == "1"){
    		isz = "确定要置顶吗"
    	}else{
    		isz = "确定要取消置顶吗"
    	}
    	
    	  layer.confirm(isz, {icon: 3}, function (index) {
            layer.close(index);
            window.location.href = "{:url('zhiding')}?id=" + id+"&value="+value;
        });
    	
    }
    
        
    function zd(id,value){
    	var isz;
    
    	if(value == "1"){
    		isz = "确定要推荐吗"
    	}else{
    		isz = "确定要推荐吗"
    	}
    	
    	  layer.confirm(isz, {icon: 3}, function (index) {
            layer.close(index);
            window.location.href = "{:url('tuijian')}?id=" + id+"&value="+value;
        });
    	
    }
    
    
    
</script>